package net.sx.minemodule.mvp.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;

import com.alibaba.android.arouter.launcher.ARouter;
import com.homegoods.aroutercomment.ARouterPath;
import com.kedll.library.mvp.BaseModel;

/**
 * @author 11470
 */
public class UserBean extends BaseModel implements Parcelable {
    public static final Creator<UserBean> CREATOR = new Creator<UserBean>() {
        @Override
        public UserBean createFromParcel(Parcel source) {
            return new UserBean(source);
        }

        @Override
        public UserBean[] newArray(int size) {
            return new UserBean[size];
        }
    };
    /****/
    private String userName;
    /****/
    private String userHeadPath;
    /****/
    private int userType;
    /****/
    private String phone;

    public UserBean() {
    }

    protected UserBean(Parcel in) {
        this.userName = in.readString();
        this.userHeadPath = in.readString();
        this.userType = in.readInt();
        this.phone = in.readString();
    }
    /**
     *点击用户名
     */
    public void userNickNameClick(View view) {
        ARouter.getInstance().build(ARouterPath.PATH_MINE_SETTING_USER_INFO_UPDATE_NICK_NAME).withAction(userName).navigation();
    }

    /**
     *点击会员中心
     */
    public void userMemberClick(View view) {
        ARouter.getInstance().build(ARouterPath.PATH_MINE_SUPER_MEMBER).navigation();
    }

    /**
     * 点击手机号
     * @param view
     */
    public void userPhoneClick(View view) {
        ARouter.getInstance().build(ARouterPath.PATH_BINDING_NEW_PHONE).withString("phone",phone).navigation();
    }

    /**
     * 点击收货地址
     * @param view
     */
    public void userAddressClick(View view) {
        ARouter.getInstance().build(ARouterPath.PATH_ADDRESS_MANAGER).navigation();
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "userName='" + userName + '\'' +
                ", userHeadPath='" + userHeadPath + '\'' +
                ", userType=" + userType +
                ", phone='" + phone + '\'' +
                '}';
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserHeadPath() {
        return userHeadPath;
    }

    public void setUserHeadPath(String userHeadPath) {
        this.userHeadPath = userHeadPath;
    }

    public String getUserType() {
        if (userType == 0) {
            return "普通会员";
        } else {
            return "超级会员";
        }
    }

    public void setUserType(int userType) {
        this.userType = userType;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.userName);
        dest.writeString(this.userHeadPath);
        dest.writeInt(this.userType);
        dest.writeString(this.phone);
    }
}
